package com.maiji.cloud.controller.community;


import com.maiji.cloud.controller.BaseController;
import com.maiji.cloud.request.BaseInputDto;
import com.maiji.cloud.request.IdInputDto;
import com.maiji.cloud.response.BaseOutPutDto;
import com.maiji.cloud.response.community.ComRecsOutputDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2019-07-04
 */


@RestController
@RequestMapping("/community")
@Api(tags = {"社区"})
public class ComMsgCollectController extends BaseController{



    @PostMapping("/collect")
    @ApiOperation("动态收藏")
    public BaseOutPutDto<String> collect(@RequestBody BaseInputDto<IdInputDto> inputDto ,@RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/collect", inputDto, BaseOutPutDto.class);
    }

    @PostMapping("/cancelCollect")
    @ApiOperation("取消动态收藏")
    public BaseOutPutDto<String> cancelCollect(@RequestBody BaseInputDto<IdInputDto> inputDto ,@RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/cancelCollect", inputDto, BaseOutPutDto.class);
    }


    @PostMapping("/userCollectList")
    @ApiOperation("用户社区收藏列表")
    public BaseOutPutDto<List<ComRecsOutputDto>> userCollectList(@RequestBody BaseInputDto inputDto, @RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/userCollectList", inputDto, BaseOutPutDto.class);
    }

    @PostMapping("/cancelCollectionMsgs")
    @ApiOperation("批量删除用户收藏动态（空参为清空收藏）")
    public BaseOutPutDto cancelCollectionMsgs(@RequestBody BaseInputDto<List<String>> inputDto, @RequestHeader("maijiToken")String maijiToken){
        return postForObjectWithToken(maijiToken, REST_URL_PREFIX_COMMUNITY + "/community/cancelCollectionMsgs", inputDto, BaseOutPutDto.class);
    }
}

